package TestCases;

import pos.control.OrderControl;
import pos.entity.Order;

/**
 *
 * @author Justin Hume
 */
public class UnitTest_Orders {

    private static UnitTestOracle_OrdersAndPItems _oracle;
    
    //Constructor
    public static void RunTests() {

        _oracle = new UnitTestOracle_OrdersAndPItems();

        Order testOrder = _oracle.getOracleOrder();

        //Test 1
        testOrderPriceCalculation(testOrder);
    }


    //Test 1: Calculations for order are the correct sums
    private static void testOrderPriceCalculation(Order testOrder) {

        OrderControl orderControl = new OrderControl();

        Order resultOrder = orderControl.updateOrderTotalPrices(testOrder, testOrder.getPurchasedItems());

        if (_oracle.orderIsValid(resultOrder) == true) {
            System.out.println("TEST PASSED: order price calculation TEST");
        }
        else {
            System.out.println("TEST FAIL: order price calculation TEST");
        }
    }
}
